<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<form action="">
			<input type="text" name="account" />
			<input type="password" name="password" id="" />
			<input type="checkbox" name="hobbies" id="" />
			<select name="fruits" id="">
				<option value="apple">苹果</option>
				<option value="orange">橘子</option>
			</select>
		</form>

		<script>
			var formEl = document.body.firstElementChild // as HTMLFormElement
			var formEl1 = document.forms[0]

			// 获取form中的子元素
			var inputEl = formEl.elements.account
			setTimeout(function () {
				console.log(inputEl.value)
			}, 5000)
		</script>
	</body>
</html>
